<template>
	<div class="actives">
		<div class="fixed">
			<div class="title flex">
				<div class="title_left">
					<img @click="back" src="../assets/image/return.png" />
				</div>
				<div class="add">
					查看报名活动
				</div>
				<div>

				</div>
			</div>

			<div class="top flex">

				<div v-for="(item,index) in nameoptions" v-bind:class="{active:index==isActive}" @click="checkItem(index)">{{item.titile}}</div>

			</div>
		</div>
		<div class="lists"  v-if="tableData">

			<div class="list " v-for="(item,index) in tableData" :key="index" >
				
				<div class="jujue flex" v-if="item.link_to_status=='2'">
					<div class="left flex">
						<div>券号：{{item.list.active_id}}</div>
						<div>{{item.list.active_name}}</div>
					</div>
					<div class="right flex" @click="showtost(item.exit_desc)"> 
						<span>理由说明</span><img src="../assets/image/liyoushuoming.png" />

					</div>
				</div>
				<div v-else class="mes flex" @click="skip_add_quan_detail(item.list.active_id,item.link_market_store_id)">
					<div class="left flex">
						<div>券号：{{item.list.active_id}}</div>
						<div>{{item.list.active_name}}</div>
					</div>
					<div class="right flex" v-if="item.link_to_status=='0'">
						<img  src="../assets/image/baomingchenggong.png" />
						<span>已报名</span>
					</div>
					<div class="right flex" v-if="item.link_to_status=='1'">
						<img  src="../assets/image/yishenhe.png" />
						<span>已通过</span>
					</div>
					
				   

						

					
				</div>

			</div>
			
		</div>
		
		<div class="none flex" v-else>
				空空如也哦~
			</div>
		<div class="mask">
		<div class="tip flex">
			<div class="tip_title flex">
				<div >
					
				</div>
				<div>
				理由说明	
				</div>
				<img  @click="yincang" src="../assets/image/chahao.png"/>
				
			</div>
			<div class="center">
				<div>
					{{exit_desc}}
				</div>
				
			</div>
			<div class="tip_btn flex">
					<div  @click="yincang">我知道了</div>
				</div>

		</div>
	</div>
	</div>
	
</template>

<script>
	export default {
		data() {
			return {
				isActive: 0,
				show: -1,
				activeIndex: -1,
				exit_desc:"",
				nameoptions: [{
						titile: '全部'
					},
					{
						titile: '已报名'
					},
					{
						titile: '已通过'
					},
					{
						titile: '拒绝'
					}
				],
				pass:0,
				tableData:"",
			}
		},
		//在模板渲染成html前调用，即通常初始化某些属性值，然后再渲染成视图
		created: function() {

		},
		methods: {
			back() {
				this.$router.go(-1)
			},

			checkItem(index) {
				this.isActive = index;
				if(index==0){
					this.list()
				}
				if(index==1){
					this.list(0)
				}
				if(index==2){
					this.list(1)
					
				}
				
				if(index==3){
					this.list(2)
					
				}
			},
			showop(index) {
				let that = this;
				if(that.show == index) {
					that.show = -1; //在这里就将它赋值为-1  由于：-1 !=  index 所以其他内容隐藏 ，被点击的则打开
				} else {
					that.show = index; //这里是把index赋值给isShow，isShow=index则显示
				}

			},
			//查看详情
			skip_add_quan_detail(active_id,coupon_id) {
				this.$router.push({
					path: '/add_quan_detail',
					query:{
						active_id:active_id,
						coupon_id:coupon_id
					}
				});
			},
			showtost(exit_desc){
				  $(".mask").css('display', 'block');
				  this.exit_desc=exit_desc;
			},
			yincang(){
				 $(".mask").css('display', 'none');
			},
			 list(e){
           	var that=this;
           var qs = require('qs');
			that.$http.post(this.baseURL+"/index.php/waveguest/coupon/my_counpon_list", qs.stringify({
						"store_id": localStorage.getItem("store_id"),
						"status":e,
						"key":localStorage.getItem("key")
				})).then(response => {
					console.log(response)
					that.tableData=response.data.data
					console.log(response.data.data)
					})
					.catch(error => {

					});
    
          },
		},
		mounted() {
this.list()
		},
	}
</script>

<style>

</style>
<style scoped="scoped">
	.active {
		color: #007AFF;
	}
	
	.top {
		font-size: 0.60869rem;
		width: 100%;
		max-width: 640px;
		background: white;
		justify-content: space-around;
		padding-bottom: 0.3rem;
	}
	
	.mes {
		margin: 0.5rem;
		font-size: 0.8rem;
		justify-content: space-between;
	}
	
	.mes .right {
		justify-content: flex-end;
		align-items: center;
		color: #868E91;
	}
	
	.mes .right>img {
		width: 0.47826rem;
		height: 0.47826rem;
		padding-right: 0.2rem;
	}
	
	.mes .right>span {
		font-size: 0.565217rem;
	}
	
	.jujue {
		margin: 0.5rem;
		font-size: 0.8rem;
		justify-content: space-between;
	}
	
	.jujue .right {
		justify-content: flex-end;
		align-items: center;
		color: #007AFF;
	}
	
	.jujue .right>img {
		width: 0.43478rem;
		height: 0.43478rem;
		padding-left: 0.2rem;
	}
	
	.jujue .right>span {
		font-size: 0.565217rem;
	}
	
	.title_left {
		width: 0.67391rem;
		height: 0.67391rem;
	}
	
	.title_left>img {
		width: 0.67391rem;
		height: 0.67391rem;
	}
	
	.lists {
	
		-webkit-overflow-scrolling : touch;
		position: fixed;
		bottom: 0;
		top: 3rem;
		background: #F5F6FA;
		width: 100%;
		padding-top: 1rem ;
		overflow-y: scroll;
		
	}
	
	.list {
		/*border: 1px solid white;*/
		margin-bottom: 0.5rem;
		margin-left: 0.5rem;
		margin-right: 0.5rem;
		padding: 0.1rem 0.3rem;
		background: url(../assets/image/beijing.png) no-repeat;
		background-size: 100%;
		border-radius: 10px;
		
	}
	
	.fixed {
		position: fixed;
		top: 0;
		background: white;
		width: 100%;
		max-width: 640px;
		z-index: 99;
	}
	
	.title {
		width: 90%;
		padding: 0 5% 0 5%;
		height: 2rem;
		font-size: 0.7193rem;
		background: white;
		padding-bottom: 0.45217rem;
		align-items: center;
	}
	
	.title div {
		width: calc(100%/3);
		align-items: center;
	}
	
	.title>div:nth-child(2) {
		text-align: center;
	}
	
	.add>img {
		width: 1rem;
		height: 1rem;
	}
	
	.left {
		flex-direction: column;
	}
	
	.mes>.left>div:nth-child(1) {
		color: #868E91;
		font-size: 0.47826rem;
	}
	
	.mes>.left>div:nth-child(2) {
		color: #3E474E1;
		font-size: 1.10869rem;
		font-weight: 400;
	}
	
	.jujue>.left>div:nth-child(1) {
		color: #BEC2C5;
		font-size: 0.47826rem;
	}
	
	.jujue>.left>div:nth-child(2) {
		color: #BEC2C5;
		font-size: 1.10869rem;
		font-weight: 400;
	}
	
	.operation {
		height: 1rem;
		justify-content: space-between;
		align-items: center;
		width: 95%;
		margin: auto;
		font-size: 0.60869rem;
		padding: 0.2rem 0;
	}
	
	.operation_left {
		height: 100%;
		align-items: center;
	}
	
	.operation_left img {
		width: 0.3919rem;
		height: 0.3919rem;
		padding-right: 0.5rem;
	}
	
	.operation>img {
		width: 0.2919rem;
		height: 0.5819rem;
	}
	
	.shows {
		border-top: 1px solid #D1D5D8;
		width: 95%;
		margin: auto;
	}
	.mask {
		position: fixed;
		width: 100%;
		left: 0;
		top: 0;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.4);
		transition: all 0.2s ease-in;
		z-index: 99;
		display: none;
	}
	.tip{
	  position: fixed;
	  left: 50%;
	  top: 50%;
	  width: 13.78260rem;
	  height:8.69565rem;
	  margin-top: -4.3478rem;
	  margin-left: -6.89282rem;
	  background: white;
	  border-radius: 0.5rem;
	  flex-direction: column;
	}
	.tip_title{
		width:90%;
		padding: 5%;
		font-size: 0.69565rem;
		justify-content: space-between;
		align-items: center;
	}
	
	.tip_title img{
		width:0.565212rem;
		height: 0.565212rem;
		
		
	}
	.center div{
		width:90%;
		margin-left: 5%;
		text-align: center;
		height: 3.63043rem;
	   font-size: 0.565217rem;
		
	}
	.tip_btn{
		width: 100%;
		height: 1.9043rem;
		justify-content: center;
		align-items: center;
	}
	.tip_btn>div{
		width: 6.3913rem;
		height: 1.3043rem;
		background: #007AFF;
		border-radius: 0.47826rem;
		color: white;
		font-size: 0.60869rem;
		text-align: center;
		line-height: 1.3043rem;
	}
	.none{
		position: fixed;
		width: 100%;
		height: 100%;
		background: #F5F6FA;
		justify-content: center;
		align-items: center;
		font-size: 0.5217rem;
	}
</style>